<?php 
	include 'includes/conectionMySql.inc';
	
	$id = $_GET['id'];
	$query = "SELECT func.telefone as telefone, func.email as email FROM funcionarios func where id =  ".$id;	
	$result = mysql_query($query);
	$linha = mysql_fetch_array($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Roteiro Funcionário</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/vader/jquery-ui.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />

<script src="js/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.10.3.custom.js"></script>
<script src="js/jquery.jqGrid.src.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-pt-br.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
		jQuery('#list1').jqGrid({
			url:"listRotas.php?id=<?php echo $id?>",
			datatype:'json',
			mtype: 'GET',
			colNames:['Nome Rota','Nome Marca','Hora Inicio','Almoço Inicio','Almoço Fim','Hora Fim'],
			colModel:[
				{name:'nome',index:'nome',width:296},
				{name:'marca',index:'marca',width:120},
				{name:'inicio',index:'inicio',width:120},
				{name:'almocoIni',index:'almocoIni',width:120},
				{name:'almocoFim',index:'almocoFim',width:140},
				{name:'fim',index:'fim',width:120}
			],
			rowNum:10,
			rowList:[10,20,50],
			pager: '#pager1',
			sortname:'id',
			viewrecords: true,
			sortorder:"asc",
			caption:"Lista de Roteiros"
		});	
	});
</script>
</head>

<body>
<h2>Roteiro Funcionário</h2>
<table border="0">
	<tr>
    	<td>Telefone funcionário: </td>
        <td><?php echo ($linha[0]=='')?'Não possui telefone cadastrado.':$linha[0];?></td>
    </tr>
    <tr>
    	<td>E-mail funcionário: </td>
        <td><?php echo ($linha[1]=='')?'Não possui e-mail cadastrado.':$linha[1];?></td>
    </tr>
</table>
<form action="insereChecklist.php" method="post">
<input type="hidden" name="id" value="<?php echo $id?>"/>
<table>
<tr>
	<td>Data:</td>
    <td><input type="text" name="data" value="<?php echo date("d/m/Y")?>" readonly="readonly"/></td>
</tr>
<tr>
	<td>Status</td>
    <td>
    	<select name="slctStatus">
        	<?php 
				$query = "SELECT id, status FROM checklist_status WHERE 1";
				$result = mysql_query($query);
				while($row = mysql_fetch_array($result)){
					?>
                    	<option value="<?php echo $row[0]?>"><?php echo $row[1]?></option>
                    <?php
				}
			?>
        </select>
    </td>
    <td>
	    <input type="submit" name="btnOk" value="OK"/><input type="hidden" name="envia" value="1"/>
    </td>
</tr>
</table>
</form><br />

	<table id="list1" name="list1"></table>
	<div id="pager1" name="pager1"></div>
    
    <p align="center"><a href="index.php">Voltar para menu inicial</a></p>    
</body>
<?php 
	mysql_close($db);
?>
</html>